//package xyz.xtt.exchange.vo;
//
//import java.util.Date;
//import java.util.Objects;
//
//import cn.hutool.core.date.DateField;
//import cn.hutool.core.date.DatePattern;
//import cn.hutool.core.date.DateUtil;
//import lombok.AllArgsConstructor;
//import lombok.Builder;
//import lombok.Data;
//import lombok.NoArgsConstructor;
//import lombok.extern.slf4j.Slf4j;
//import xyz.xtt.exchange.request.OperateUpRequest;
//import xyz.xtt.exchange.utils.DateUtils;
//
//@Slf4j
//@Data
//@Builder
//@AllArgsConstructor
//@NoArgsConstructor
//public class AssetCalcHandler {
//	private Long preStart;
//	private Long preEnd;
//	private Long publicityPeriodStart;
//	private Long publicityPeriodEnd;
//	private Long end() {
//		return 0L;
//	}
//	/**
//	 * @param operateUpRequest
//	 * @param secodeType
//	 * @param checkPublicityPeriod 公示期是否完整
//	 * @return
//	 */
//	public static AssetCalcHandler buildCalc(OperateUpRequest operateUpRequest, int secodeType, boolean checkPublicityPeriod) {
//		int offset = 15;
//		if (Objects.equals(secodeType, 3)) {
//			Date date = DateUtil.date();
//			Date beginOfDay = DateUtil.beginOfDay(date);
//			Long emptyStart = DateUtil.toInstant(beginOfDay).toEpochMilli();
//			return AssetCalcHandler.builder().preStart(emptyStart).preEnd(emptyStart).build();
//		}
//		// 没有预售期 等于当前时间
//
//		boolean checkPresellIsNull = operateUpRequest.checkPresellIsNull();
//		long curr = System.currentTimeMillis();
//		Long start = curr;
//		Long end = curr;
//		if (checkPresellIsNull) {
//			Date date = DateUtil.date();
//			Date beginOfDay = DateUtil.beginOfDay(date);
//			// 如果完整公示, 没填时间，算到当天开始
//			// 没有完整公示，向后退15天，前14天为公示时间
//			if (checkPublicityPeriod) {
//				Long beginTs = DateUtil.toInstant(beginOfDay).toEpochMilli();
//				return AssetCalcHandler.builder().preStart(beginTs).preEnd(beginTs).build();
//			}
//
//			Date newDate = DateUtil.offset(beginOfDay, DateField.DAY_OF_MONTH, offset);
//			Long emptyStart = DateUtil.toInstant(newDate).toEpochMilli();
//			start = end = emptyStart;
//		} else {
//			start = DateUtils.strToEpochMilli(operateUpRequest.getPresellStart(), " 00:00:00");
//			end = DateUtils.strToEpochMilli(operateUpRequest.getPresellEnd(), " 23:59:59");
//		}
//		return AssetCalcHandler.builder().preStart(start).preEnd(end).build();
//	}
//
//	public static AssetCalcHandler buildDefault() {
//		return AssetCalcHandler.builder().preStart(0L).preEnd(0L).build();
//	}
//
//	public void showPublic() {
//		String start = DateUtil.format(DateUtil.date(preStart), DatePattern.NORM_DATETIME_PATTERN);
//		String send = DateUtil.format(DateUtil.date(preEnd), DatePattern.NORM_DATETIME_PATTERN);
//		log.info("s1:{}", start);
//		log.info("s2:{}", send);
//	}
//
////	public static void main(String[] args) {
////		// OperateUpRequest build =
////		// OperateUpRequest.builder().presellStart("2025-03-21").presellEnd("2025-03-23").build();
////		OperateUpRequest build = OperateUpRequest.builder().presellStart("").presellEnd("").build();
////		PreSellInfoVo buildCalc = buildCalc(build, 0, true);
////		buildCalc.showPublic();
////		
////		Date date = DateUtil.date();
////		Date beginOfDay = DateUtil.beginOfDay(date);
////		// 实际会多算一天
////		Date newDate = DateUtil.offset(beginOfDay, DateField.DAY_OF_MONTH, 14);
////		Date endOfDay = DateUtil.endOfDay(newDate);
////
////		Long publicityPeriodStart = DateUtil.toInstant(beginOfDay).toEpochMilli();
////		Long publicityPeriodEnd = DateUtil.toInstant(endOfDay).toEpochMilli();
////		
////		String start = DateUtil.format(DateUtil.date(publicityPeriodStart), DatePattern.NORM_DATETIME_PATTERN);
////		String send = DateUtil.format(DateUtil.date(publicityPeriodEnd), DatePattern.NORM_DATETIME_PATTERN);
////		System.out.println("s3: " + start);
////		System.out.println("s4: " + send);
////	}
////
////	public static void main1(String[] args) {
////		Date date = DateUtil.date();
////		Date beginOfDay = DateUtil.beginOfDay(date);
////		Long emptyStart = DateUtil.toInstant(beginOfDay).toEpochMilli();
////		System.out.println("emptyStart:\t" + emptyStart);
////		String format = DateUtil.format(DateUtil.date(emptyStart), DatePattern.NORM_DATETIME_PATTERN);
////		System.out.println("format:\t" + format);
////	}
//}
